import 'package:badges/badges.dart';
import 'package:flutter/material.dart';

import '../../../../config/global_config.dart';
import '../../../../utils/screenutil/fit.dart';

class Record extends StatelessWidget {
  String _name;
  double _top;
  bool _isShowBadge;
  Function _callBack;

  Record(
    String name, {
    double top = 0,
    bool isShowBadge = false,
    Function callBack = null,
  })  : this._name = name,
        this._top = top,
        this._isShowBadge = isShowBadge,
        this._callBack = callBack;

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      padding: EdgeInsets.symmetric(horizontal: 20.f, vertical: 25.f),
      margin: EdgeInsets.only(top: _top),
      child: InkWell(
        onTap: () => _callBack(),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            _isShowBadge
                ? Badge(
                    position: BadgePosition.topStart(
                      start: 90.f,
                      top: 1.f,
                    ),
                    padding: EdgeInsets.all(5.f),
                    badgeContent: null,
                    child: Text(
                      "$_name",
                      style: TextStyle(
                        fontSize: 24.f,
                      ),
                    ),
                  )
                : Text(
                    "$_name",
                    style: TextStyle(
                      fontSize: 24.f,
                    ),
                  ),
            Icon(
              Icons.chevron_right,
              color: GlobalConfig.assistColor,
            )
          ],
        ),
      ),
    );
  }
}
